package com.campusbackend.mapper;

import com.campusbackend.entity.TeamMembers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * <p>
 * 队伍成员表 Mapper 接口
 * </p>
 *
 * @author yezi
 * @since 2025-07-26
 */
@Mapper
public interface TeamMembersMapper extends BaseMapper<TeamMembers> {

    /**
     * 更新队员评分
     * @param teamId 队伍ID
     * @param studentId 学生ID
     * @param score 评分
     * @return 更新行数
     */
    @Update("UPDATE team_members SET score = #{score}, update_time = NOW() " +
            "WHERE team_id = #{teamId} AND student_id = #{studentId} AND join_status = 1")
    int updateMemberScore(@Param("teamId") Long teamId, 
                         @Param("studentId") Long studentId, 
                         @Param("score") BigDecimal score);
} 